package com.itwn.email.producer.f_confirm;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 消息确认
 * 队列：confirm.queue
 * 交换机：confirm.direct.exchange
 * 路由key：msg.configm
 */
@Configuration
public class ConfirmConfig {

    @Bean
    public Queue confirmQueue(){
        return new Queue("confirm.queue");
    }
    @Bean
    public DirectExchange directConfirmExchange(){
        return new DirectExchange("confirm.direct.exchange");
    }

    @Bean
    public Binding bindingDirectExchangeAndQueue(
            Queue confirmQueue,DirectExchange directConfirmExchange){
        return BindingBuilder.bind(confirmQueue).to(directConfirmExchange).with("msg.confirm");
    }


}
